<?php
/**
 * Created by PhpStorm.
 * User: fangwei
 * Date: 2019-10-04
 * Time: 08:23
 */

namespace App\Http\Controllers\Admin\Api;


use App\Http\Controllers\Controller;
use App\Http\Repositories\Services\IOrder;
use App\Http\Requests\Admin\OrderInputDTO;
use App\Util\LayUiVo;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Lang;

class OrderController extends Controller
{
    protected $orderService;
    public function __construct(IOrder $orderService)
    {
        $this->orderService = $orderService;
    }

    public function page(Request $request) {
        $search = [];
        $data =$this->orderService->lists($search,$request->get('page',1),$request->get('size',10));
        return response()->json(new LayUiVo(['data'=>$data,'message'=>Lang::get('response.success')]));
    }

    public function store(OrderInputDTO $inputDTO){
        $this->orderService->store($inputDTO);
        return response()->json(new LayUiVo(['message'=>Lang::get('response.success')]));
    }


}